/**
 * Copyright (C) 2010  Johan Basson
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 */

package symorg.util;

import java.util.Enumeration;
import java.util.Vector;
import javax.microedition.io.file.FileSystemRegistry;

/**
 *
 * @author johan
 */
public class General {

    /**
     * Retreive roots from file systems
     *
     * @return
     */
    public static String[] getRoots() {
        try {
            Enumeration enumeration = FileSystemRegistry.listRoots();
            Vector temp = new Vector();
            String root = "";
            while (enumeration.hasMoreElements()) {
                root = (String) enumeration.nextElement();
                if (true) {
                    temp.addElement(root);
                } else {
                    temp.addElement(root);
                }
            }
            String[] ret = new String[temp.size()];
            temp.copyInto(ret);
            return ret;

        } catch (Exception exception) {
            exception.printStackTrace();
            return null;
        }
    }

}
